home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / AppleScript / Development Tools / Tools Goodies / AEGizmos 1.4.1 / Headers / AESubDescs.h < prev   
Encoding:
Text File  |  1995-03-17  |  2.1 KB  |  72 lines  |  [TEXT/MMCC]

  1. // AESubDescs.h
  2. //
  3. // A high-efficiency way to examine AEDescs. Everything is done in place, without any
  4. // copying of data, which avoids most of the overhead of the Apple Event Manager.
  5. //
  6. // By Jens Alfke; Copyright ©1992-95 Apple Computer. All Rights Reserved.
  7.  
  8.  
  9. #pragma once
  10.  
  11. #ifndef __AESUBDESCS__
  12. #define __AESUBDESCS__                                /* For poor MPW users :) */
  13.  
  14. #ifndef __APPLEEVENTS__
  15. #include <AppleEvents.h>
  16. #endif
  17.  
  18.  
  19. enum{                                                // Error code
  20.     errAEListIsFactored        = -1760                        // I cannot get data from factored lists
  21. };
  22.  
  23.  
  24. struct AESubDesc {
  25.     DescType    subDescType;        // Type of this subDesc. You may read this field.
  26.     Handle        dataHandle;            // Handle to main (outer) descriptor. Private.
  27.     long        offset;                // Offset into main descriptor where subDesc starts. Private.
  28. };
  29.  
  30. typedef struct AESubDesc AESubDesc;
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. pascal void
  37.     AEDescToSubDesc( const AEDesc*, AESubDesc* );                    // Create subDesc on desc
  38. pascal OSErr
  39.     AESubDescToDesc( const AESubDesc*, long desiredType, AEDesc* );    // Copy subDesc to new desc
  40.  
  41. pascal DescType
  42.     AEGetSubDescType( const AESubDesc* );                            // Same as ->subDescType
  43. pascal void*
  44.     AEGetSubDescData( const AESubDesc*, long *length );                // Invalid once dataHandle moves
  45. pascal void
  46.     AECopySubDescData( const AESubDesc *sd, long *length, void *dst, long maxLen );
  47. pascal Boolean
  48.     AESubDescIsListOrRecord( const AESubDesc* sd );    // Is it a list or (possibly coerced) record?
  49. pascal DescType
  50.     AEGetSubDescBasicType( const AESubDesc* );        // Returns 'reco' if it's a coerced record
  51.  
  52. // The list-oriented calls that follow make sure the subdescriptor is a valid list or (possibly
  53. // coerced) record. If not, they'll return errAEWrongDataType.
  54.  
  55. pascal long
  56.     AECountSubDescItems( const AESubDesc* );
  57.  
  58. // In these next two calls, it's okay if newSD == sd; sd will be overwritten with the new subDesc.
  59.     
  60. pascal OSErr
  61.     AEGetNthSubDesc( const AESubDesc* sd, long index,
  62.                      AEKeyword* keyIfAny, AESubDesc* newSD ),
  63.     AEGetKeySubDesc( const AESubDesc* sd, AEKeyword,                // Lists illegal here
  64.                      AESubDesc* newSD );
  65.  
  66. #ifdef __cplusplus
  67. }
  68. #endif
  69.  
  70. #endif /*__AESUBDESCS__*/
  71.  
  72.